import 'package:flutter/material.dart';
import 'package:flutterdemo/0demo/utils/bus.dart';

class Page3 extends StatefulWidget {
  @override
  _Page3State createState() => _Page3State();
}

class _Page3State extends State<Page3> {
  @override
  void initState() {
    Future.delayed(Duration(milliseconds: 3000)).then((value) {
      Bus.instance.emit("main2login");
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("page3"),
      ),
      body: Center(
        child: RaisedButton(
          onPressed: () {
            Bus.instance.emit("main2login");
          },
          child: Text("send event main page go 2 login page."),
        ),
      ),
    );
  }
}
